package com.mdframe.ai.agent.controller;

import com.mdframe.ai.agent.client.AssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;



/**
 * @date 2024/10/17
 */
@RestController
@RequestMapping("/agent")
public class ChatController {
    
    @Autowired
    private AssistantService assistantService;
    
    @GetMapping("/chat")
    public Flux<String> chat(@RequestParam("chatId") String chatId,@RequestParam("userMessage") String userMessage) {
        return assistantService.chat(chatId, userMessage);
    }
    
    @GetMapping("/codeGen/chat")
    public Flux<String> codeGen(@RequestParam("chatId") String chatId,@RequestParam("userMessage") String userMessage) {
        return assistantService.codeGenChat(chatId, userMessage);
    }
    
    @GetMapping("/stream-chat")
    public Flux<String> streamChat(@RequestParam("chatId") String chatId,@RequestParam("userMessage") String userMessage) {
        return null;
    }
    
}
